
<{include file="www/header.tpl"}>
<{include file="www/header-base.tpl"}>

<{if not $guiders}>

<div class="box-none" style="padding: 300px 0;">
    <img src="/resource/www/imgs/box_none_icon.png" class="img">
    <p class="text">抱歉，你还没有行程单</p>
</div>


<{else}>
<h2 class="base-title">我的行程单</h2>

<div class="itinerary-box">
    <h3 class="title">温馨提示：您可以添加多条行程，但请安排好每条形成的时间，避免时间冲突</h3>
    <form class="itine-form" action="/order/pay_orders" method="POST">
    <{foreach from=$guiders item="group"}>
        <div class="itine-box">
        <label class="head">
            <input type="checkbox" name="guiderUid<{$group.guider.userUid}>" class="checkbox" onclick="click_choose(this);">
            <img src="<{$group.guider.userIcon}>" class="user">
            <span class="name"><{$group.guider.userFamily}> <{$group.guider.userName}></span>
        </label>
        <ul class="ul">
            <{foreach from=$group.orders item="order"}>
            <li class="li">
                <label class="label fix">
                    <input type="checkbox" name="orderId[]" value="<{$order.id}>" class="checkbox">
                    <div class="date">
                    <p class="text"><{$order.startDay}></p>
                    <p class="line-xian">|</p>
                    <p class="text"><{$order.stopDay}></p>
                    </div>
                    <img src="<{$order.goods.thumb}>" alt="" class="img">
                    <div class="right">
                        <p class="miaos">[ <{if $order.goodsType == 'TRACK'}>我的路线<{elseif $order.goodsType == 'ACTIVITY'}>我的活动<{else}>哇吖自营<{/if}> ]
                            <{$order.title}></p>
                        <p class="fy">
                            出行人数：<span class="span"> <{$order.persons}>人</span>&nbsp;&nbsp;
                            支付费用：<span class="span">欧元: <{$order.moneyGoods/100|round:2}>&nbsp;€</span>
                        </p>
                        <a target="_blnak" href="/order/detail/<{$order.orderNo}>" class="view-de">查看详情</a>
                    </div>
                </label>
            </li>
            <{/foreach}>

        </ul>
         </div>
        <{/foreach}>
        <div class="bottom">
            <input type="button" onclick="remove_order(this)" name="submit_op" value="删除所选" class="del">
            <input type="submit" name="submit_op"  value="结算所选" class="submit" onclick="return jies_order(this);">
        </div>

    </form>

</div>
    <{/if}>

<script>

function click_choose(item) {
    if (item.checked) {
        $(item).parents('.itine-box').find(".label input[type='checkbox']").each(function() {
            if ($(this).attr('disabled')) {
                this.checked = false;
            } else {
                this.checked = true;
            }
        });
    } else {
        $(item).parents('.itine-box').find(".label input[type='checkbox']").each(function() {
            this.checked = false;
        });
    }
}

</script>

<script>
    // function remove_order(item){
    //     var form = $(item).parent().parent();

    //     form.attr('action','/order/remove_all').submit();
    // }

    function remove_order(item){

        var aCheck = $(item).parents('.itine-form').find(".label input[type='checkbox']").is(':checked');

        if (!aCheck) {
            layer.msg('请至少选择一项');
            return false;
        } else {
            layer.confirm('确认删除这条行程吗', {
                btn: ['是的','取消'], //按钮
                title: false,
                area: ['200px', '150px']
            }, function(){
                var form = $(item).parent().parent();
                form.attr('target','_self');
                form.attr('action','/order/remove_all').submit();
            }, function(){
                return;
            });
        }
    }

    function jies_order(item) {

        var aCheck = $(item).parents('.itine-form').find(".label input[type='checkbox']").is(':checked');

        if (!aCheck) {
            layer.msg('请至少选择一项');
            return false;
        }
    }

</script>

<{include file="www/footer.tpl"}>
